﻿@model yq.Model.Logic.UserLogin
@using (Ajax.BeginForm("DoAddLogin", new { }, new AjaxOptions { HttpMethod = "post", OnSuccess = "InitializeTips" }))
{ @Html.HiddenFor(obj => obj.UserId)
    <div>
        <table class="table table-condensed"  width="400px">
            <tbody>
                <tr>
                    <td>
                        @(Html.RawFor(obj => obj.Account))
                    </td>
                    <td>
                        @Html.TextBoxFor(obj => obj.Account)
                    </td>
                </tr>
                <tr>
                    <td>
                        @(Html.RawFor(obj => obj.PassWord))
                    </td>
                    <td>
                        @Html.PasswordFor(obj => obj.PassWord, new { onchange = "onRePassWord()" })
                    </td>
                </tr>
                <tr>
                    <td>
                        确认密码
                    </td>
                    <td>
                        @Html.Password("RePassWord", null, new { onchange = "onRePassWord()" })
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        @Html.Submit(" 添 加 ", new { onclick = "return onRePassWord()" })
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
}
<script>

    function InitializeTips(obj)
    {
        if (obj.Status == 1)
        {
               $.tips("添加成功");
               setTimeout("window.location = window.location;",2000);
        } else
        {
            $.tips(obj.ErrorText);
        }

    }

    function onRePassWord()
    {
        if ($("#RePassWord").val() + "a" == "a" || $("#RePassWord").val() != $("#PassWord").val())
        {
            $.inputError("RePassWord", "请确认密码");
            return false;
        } else
        {
            $.inputYes("RePassWord");
            return true;
        }
    }
</script>
